-
Notifications
You must be signed in to change notification settings - Fork 360
Implement sass --embedded
in pure JS mode
#2413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
8d7d4de
to
7084da7
Compare
e66df5b
to
d53fcc5
Compare
d7e6206
to
b3794eb
Compare
9112b44
to
54fabf3
Compare
257b4fd
to
ac718ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally managed to carve out some time for this. I haven't done a complete review yet, but this should be enough to get you started.
if (_gracefulShutdown) { | ||
_channel.sink.close(); | ||
} else { | ||
exit(exitCode); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also changing the current behavior for the Dart VM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it's not changing any behavior for end users, see #2413 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VM was previously calling _channel.sink.close()
here. Since _gracefulShutdown
is only needed to work around issues with Node.js, does this code need to change at all? Or could we just have the VM gracefully shut down even though it doesn't strictly need to, just to remove some extra complexity?
Either way, it's worth documenting those Node.js issues in the code itself so we know what to work around when making changes in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another partial review, but I think we're making good progress!
lib/src/embedded/js/concurrency.dart
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can also just go in the existing io
catch-all.
if (_gracefulShutdown) { | ||
_channel.sink.close(); | ||
} else { | ||
exit(exitCode); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VM was previously calling _channel.sink.close()
here. Since _gracefulShutdown
is only needed to work around issues with Node.js, does this code need to change at all? Or could we just have the VM gracefully shut down even though it doesn't strictly need to, just to remove some extra complexity?
Either way, it's worth documenting those Node.js issues in the code itself so we know what to work around when making changes in the future.
lib/src/embedded/js/io.dart
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be part of the existing IO library (which already has definitions for exitCode
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I was trying to implement this with new js interop from dart 3.3 without relying on the node_interop package which heavily depends on deprecated dart:js_util
, which will start to break at some point.
For exitCode
I can use the existing one we have.
What about Stdin
, Stdout
, Stderr
? These are effectively wrapper classes on node stdio to create an interface that's same as the dart built-in classes while it only partially implement necessarily methods we need on those interface. @nex3 What's your preference here? Create another interface that wraps the original dart interface?
lib/src/embedded/js/js.dart
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any work to expose existing JS APIs should go in lib/src/js
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is a saparate file because it's new js interop from dart 3.3, which I found a bit awkward to put it together with the classic interop code in the same place. Any recommendation on how to deal with it?
Applied most of the feedbacks. However, I have a awkward feeling about mixing classic js interop and new js interop in the same file, which is why I have lots of js specific things with new interop are only in embedded folder instead of in the generic folder. @nex3 I haven't changed these yet, as I want to hear what's your thought on this. |
Another note: The reason I tried to avoid classic interop and node_introp is that I couldn't get The new dart 3.3 js interop on the other hands was way more straight forward to use and debug. I got |
Closes #2325.
sass/embedded-host-node#344
Implementation
The actual isolate dispatcher and compilation dispatcher are nearly unchanged. However, I had to replace isolate with worker communication, and mock tons of small things that do not work on node.
Testing